
{% extends 'authuser/base.html' %}
{% block content %}
<style type="text/css" media="screen" id="test">
	.warn{
		color: red;
	}
</style>

<script type="text/javascript">
	next="{{next |default:'/'}}"
	login_url='{{login_url}}'
	
	heads = {{heads | safe}}
	fix = [{name:'username',autofocus:true,label:'用户名'},
			{name:'password',label:'密码',type:'password'},
			{name:'pas2',label:'确认密码',type:'password'}]
	merge(heads,fix)
	
	$(function () {
		new Vue({
			el:'#content',
			data:{
				kw:{
					errors:{},
					row:{
						username:'',
						password:'',
						pas2:'',
					},
					heads: heads
				},
				
			},
			methods:{
				submit_info:function () {
					var self=this;
					var post_data={
						registe:{info:this.kw.row}
					}
					$.post('',JSON.stringify(post_data),function (data) {
						if(data.registe.errors){
							update_vue_obj(self.kw.errors,data.registe.errors)
						}else{
							location=login_url;
						}
					})
				}
			}
		})
	})
	
	
</script>

<div class='container' id='content'>
	<div ng-controller='content'>

	<form name="regForm" 
		ng-submit='submit_func(regForm.$valid)' 
		class='form-signin' novalidate>
		<h2 class='form-signin-heading'>用户注册</h2>
		
		<field name='username' :kw='kw'></field>
		<field name='password' :kw='kw'></field>
		<field name='pas2' :kw='kw'>
			<span>防止密码输错，所以请第二次输出相同的密码</span>
		</field>
		
		<button name="test" type="button" value="val" 
			class='btn btn-lg btn-primary btn-block'
			@click='submit_info()'>注册</button>
		
	</form>

	<!--<div id='stdout' ng-bind='stdout' class='form-signin' style='color:red'></div>-->
	<!--<div auto-hide data='stdout' class='form-signin' style='color:red'></div>-->
</div>

</div>
<style type="text/css">
	.form-signin{
		max-width:330px;
		padding: 15px;
		margin: 0 auto;
	}
	input{
		margin-bottom:3px;
	}
</style>

{% endblock %}